package no.eirikb.bomberman.shared.clientcommand;

import no.eirikb.bomberman.applet.game.PowerUp;
import no.eirikb.bomberman.shared.Game;
import no.eirikb.bomberman.shared.User;

/**
 *
 * @author eirikb
 */
public class PowerUpSpeedEvent extends ClientEvent {

    private User user;
    private double incSpeed;
    private PowerUp powerUp;

    public PowerUpSpeedEvent(User user, double incSpeed, PowerUp powerUp) {
        this.user = user;
        this.incSpeed = incSpeed;
        this.powerUp = powerUp;
    }

    @Override
    public void execute(Game game) {
        User u = game.getUsers().get(user.getNick());
        u.setSpeed(u.getSpeed() + incSpeed);
        game.removePowerUp(powerUp.getX(), powerUp.getY());
    }

    @Override
    public void execute(User user) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
